package ano.it.controller;

import ano.it.constant.MessageConstant;
import ano.it.entity.Result;
import ano.it.pojo.Menu;
import ano.it.service.MenuService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/menu")
public class MenuController {
    @Reference
    private MenuService menuService;
    @RequestMapping("/findByMenu")
    public Result findByMenu(String username){
        try {
            List<Menu> menu =menuService.findByMenu(username);
            return new Result(true, MessageConstant.GET_MENU_SUCCESS,menu);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, MessageConstant.GET_MENU_FAIL);
        }
    }
}
